<?php

namespace App\Models\WorkOrder;

use App\Models\BaseModel;
use App\Models\Traits\KfSoftDeletes;
use App\Models\Traits\KfUid;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class WorkflowV2TypeModel extends BaseModel
{
    use HasFactory, KfUid, KfSoftDeletes;

    protected $table = 'workflow_v2_type';

    protected $fillable = [
        'name',
        'prefix',
        'description',
        'icon',
        'sort',
        'status',
        'createdAt',
        'createdByUid',
        'updatedAt',
        'updatedByUid',
        'isDeleted',
    ];

    protected $appends = [
        'statusText'
    ];

    /**
     * 状态
     */
    const STATUS_ON  = 0;
    const STATUS_OFF = 1;

    const STATUS_MAPPING = [
        self::STATUS_ON  => '启用',
        self::STATUS_OFF => '禁用',
    ];


    /**
     * type
     */
    const TYPE_WORK_ORDER = 1;

    /**
     * statusText
     * @return string
     */
    public function getStatusTextAttribute(): string
    {
        return self::STATUS_MAPPING[$this->attributes['status']] ?? '-';
    }


}
